<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
  <head>
    <title>Example</title>
    
    <style type="text/css">
      table {
        border: 1px solid #dcdcdc;
        border-collapse: collapse;
      }
      
      th, td {
        border: 1px solid #dcdcdc;
        padding: 5px;
      }
      
      thead {
        background-color: #f4f4f4;
      }
    </style>
  </head>

  <body>
    <h1>Test Forum</h1>
    
    <h3>Threads</h3>
    
    <form action="createThread.html" method="post">
      <div>
        <label for="title">Title:</label>
        <input name="title" type="text" />
      </div>
      
      <div>
        <label for="author">Author:</label>
        <input name="author" type="text" />
      </div>
      
      <input type="submit" value="Store" />
    </form>
    
    <div>
      <a href="/index.html">Back</a>
    </div>
    
    <table>
      <thead>
        <tr>
          <th>Date</th>
          <th>Title</th>
          <th>Author</th>
          <th>Posts</th>
        </tr>
      </thead>
      <tbody>
       <c:forEach items="${threads}" var="thread">
         <tr>
           <td>${thread.date}</td>
           <td><a href="thread.html?id=${thread.threadId}">${thread.title}</a></td>
           <td>${thread.author}</td>
           <td>${fn:length(thread.posts)}</td>
         </tr>
       </c:forEach>
      </tbody>
    </table>
    
  </body>
</html>